﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Address_Book.BLL
{
    public class Operate
    {
        public bool Exct(int flag, Address_Book.Model.FriendInfo Finfo)
        {
            switch (flag)
            {
                case 0:
                    return true;
                case 1:
                    return Add(Finfo);
                case 2:
                    return Edit(Finfo);
                case 3:
                    return Delete(Finfo);
                default:
                    return true;
            }
        }
        /// <summary>
        /// 添加好友
        /// </summary>
        /// <param name="Finfo"></param>
        private bool Add(Address_Book.Model.FriendInfo Finfo)
        {
            string strOperate = "p_AddFriends";
            Address_Book.DAL.Friends exct = new Address_Book.DAL.Friends();
            return exct.UpData(Finfo, strOperate);
        }

        /// <summary>
        /// 编辑好友
        /// </summary>
        /// <param name="Finfo"></param>
        private bool Edit(Address_Book.Model.FriendInfo Finfo)
        {
            string strOperate = "p_EditFriends";
            Address_Book.DAL.Friends exct = new Address_Book.DAL.Friends();
            return exct.UpData(Finfo, strOperate);
        }

        /// <summary>
        /// 删除好友
        /// </summary>
        /// <param name="Finfo"></param>
        private bool Delete(Address_Book.Model.FriendInfo Finfo)
        {
            string strOperate = "p_DeleteFriends";
            Address_Book.DAL.Friends exct = new Address_Book.DAL.Friends();
            return exct.UpData(Finfo, strOperate);
        }

    }
}
